import 'package:flutter/material.dart';
import 'package:flutter_collection/%E6%A1%88%E4%BE%8BDemo/%E8%B1%86%E7%93%A3%E7%94%B5%E5%BD%B1top100/components/tabbar_item.dart';
import 'package:flutter_collection/%E6%A1%88%E4%BE%8BDemo/%E8%B1%86%E7%93%A3%E7%94%B5%E5%BD%B1top100/pages/group/group.dart';
import 'package:flutter_collection/%E6%A1%88%E4%BE%8BDemo/%E8%B1%86%E7%93%A3%E7%94%B5%E5%BD%B1top100/pages/home/home.dart';
import 'package:flutter_collection/%E6%A1%88%E4%BE%8BDemo/%E8%B1%86%E7%93%A3%E7%94%B5%E5%BD%B1top100/pages/mall/mall.dart';
import 'package:flutter_collection/%E6%A1%88%E4%BE%8BDemo/%E8%B1%86%E7%93%A3%E7%94%B5%E5%BD%B1top100/pages/profile/profile.dart';
import 'package:flutter_collection/%E6%A1%88%E4%BE%8BDemo/%E8%B1%86%E7%93%A3%E7%94%B5%E5%BD%B1top100/pages/subject/subject.dart';

class DoubanStackPage extends StatefulWidget {
  @override
  _DoubanStackPageState createState() => _DoubanStackPageState();
}

class _DoubanStackPageState extends State<DoubanStackPage> {
  int _currentIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Theme(
      data: ThemeData(primaryColor: Colors.green),
      child: Scaffold(
        bottomNavigationBar: BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          items: [
            TabBarItem('home', '首页'),
            TabBarItem('subject', '书影音'),
            TabBarItem('group', '小组'),
            TabBarItem('mall', '市集'),
            TabBarItem('profile', '我的'),
          ],
          selectedItemColor: Colors.green,
          currentIndex: _currentIndex,
          onTap: (int index) {
            setState(() {
              _currentIndex = index;
            });
          },
        ),
        body: IndexedStack(
          index: _currentIndex,
          children: [
            HomePage(),
            SubjectPage(),
            GroupPage(),
            MallPage(),
            ProfilePage(),
          ],
        ),
      ),
    );
  }
}
